package com.web.portal.service;

import java.util.EnumMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.web.portal.dao.AcademicProgramsSearchType;
import com.web.portal.dao.BaseDao;
import com.web.portal.entity.AcademicPrograms;
import com.web.portal.entity.AdvisorMeeting;
@Service (value="academicProgramsService")

public class DefaultAcademicProgramsService extends DefaultWebPortalService<AcademicPrograms> implements AcademicProgramsService {

	
	
	@Autowired
	@Qualifier (value="academicProgramsDao")
	public void init(BaseDao dao){
		setBaseDao(dao);
	}
	public AcademicPrograms getAcademicPrograms(String id) {
		// TODO Auto-generated method stub
		Map<AcademicProgramsSearchType, Object> searchCriteria= new EnumMap(AcademicProgramsSearchType.class);
		searchCriteria.put(AcademicProgramsSearchType.ID,id);
		List<AcademicPrograms> result=searchByCriteria(searchCriteria);
		if(!result.isEmpty() && result.size()==1){
			return result.get(0);
		}
		return null;
	}

	public void saveOrEdit(AcademicPrograms academicPrograms) {
		createOrUpdate(academicPrograms);
		
	}
	

	@Override
	@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
	protected boolean isCreate(AcademicPrograms entity) throws RuntimeException {
		// TODO Auto-generated method stub
		return false;
	}

}
